package com.zhq.zhq_blog.entity.result;

import com.zhq.zhq_blog.exception.BusinessException;
import lombok.Data;

@Data
public class CommentResultBean<T> {

    public int total;

    public T list;

    public CommentResultBean() {
    }

    public static <R> CommentResultBean<R> success(int total, R list) {
        CommentResultBean<R> commentResultBean = new CommentResultBean<>();
        commentResultBean.total = total;
        commentResultBean.list = list;
        return commentResultBean;
    }

    public static CommentResultBean fail(BusinessException businessException) {
        CommentResultBean commentResultBean = new CommentResultBean();
        commentResultBean.total = 0;
        commentResultBean.list = null;
        return commentResultBean;
    }
}
